package Test;

import Qingong.*;

public class Result {
    public static double LatestNationalWageTaxStandard(double money) {
        double TaxReceivable = 0;
        try {
            if (0 <= money && money <= 5000) {
                TaxReceivable = 0;
            }
            if (5000 < money && money <= 8000) {
                TaxReceivable = money * 0.03;
            }
            if (8000 < money && money <= 17000) {
                TaxReceivable = money * 0.10;
            }
            if (17000 < money && money <= 30000) {
                TaxReceivable = money * 0.20;
            }
            if (30000 < money && money <= 40000) {
                TaxReceivable = money * 0.25;
            }
            if (TaxReceivable < 0) {
                System.out.println("收入金额有误！");
            }
        } catch (Exception e) {
            System.out.println("收入金额有误！");
        }
        final double TaxReceivable1 = TaxReceivable;
        return TaxReceivable1;
    }

    public static void main(String[] args) { // 程序入口
        String _5weekScoringList1[] = { "优", "优", "优", "优", "优" };
        String _5weekScoringList2[] = { "及格", "及格", "及格", "及格", "及格"};
        String _5weekScoringList3[] = { "优", "及格", "及格", "及格", "优" };
        String _5weekScoringList4[] = { "及格", "及格", "优", "及格", "及格" };
        String _5weekScoringList5[] = { "及格", "优", "及格", "及格", "及格"};

        Laboratory ComputerNetworkLaboratory = new Laboratory(1, "计算机网络实验室", _5weekScoringList1);
        Laboratory CompositionPrincipleLaboratory = new Laboratory(2, "组成原理实验室", _5weekScoringList2);
        Laboratory PhysicsLaboratory = new Laboratory(3, "药理实验室", _5weekScoringList3);
        Laboratory ChemicalLaboratory = new Laboratory(4, "物理实验室", _5weekScoringList4);
        Laboratory BiologyLaboratory = new Laboratory(5, "人工智能实验室", _5weekScoringList5);

        Laboratory moren1[] = new Laboratory[5];
        Laboratory moren2[] = new Laboratory[5];
        Student Z = new Student(1, "小张", moren1, 0);
        Student Zz = new Student(2, "小周", moren2, 0);

        Z.setlaboratory(0, moren1, ComputerNetworkLaboratory); // 分配实验室
        Z.setlaboratory(1, moren1, CompositionPrincipleLaboratory);
        Zz.setlaboratory(0, moren2, PhysicsLaboratory);
        Zz.setlaboratory(1, moren2, ChemicalLaboratory);
        Zz.setlaboratory(2, moren2, BiologyLaboratory);

        Z.WorkStudyIncome(ComputerNetworkLaboratory.getCleanlinessScore(), Z); // 为实验室评分
        Z.WorkStudyIncome(CompositionPrincipleLaboratory.getCleanlinessScore(), Z);
        Zz.WorkStudyIncome(PhysicsLaboratory.getCleanlinessScore(), Zz);
        Zz.WorkStudyIncome(ChemicalLaboratory.getCleanlinessScore(), Zz);
        Zz.WorkStudyIncome(BiologyLaboratory.getCleanlinessScore(), Zz);

        System.out.println("欢迎使用学生实验室勤工俭学模拟系统！");

        System.out.println("小张:" + Z.getlaboratory()[0].getLaboratoryName() + "  "
                + Z.getlaboratory()[1].getLaboratoryName() );

        System.out.println( Z.getlaboratory()[0].getLaboratoryName() + "  5周成绩如下:");

        for (int t = 0; t < 5; t++) {
            System.out.print(Z.getlaboratory()[0].getCleanlinessScore()[t] + " ");
        }
        System.out.println();

        System.out.println(Z.getlaboratory()[1].getLaboratoryName() + "  5周成绩如下:");

        for (int t = 0; t < 5; t++) {
            System.out.print(Z.getlaboratory()[1].getCleanlinessScore()[t] + " ");
        }
        System.out.println();

        System.out.println("其纳税前收入为" + Z.getmoneyEarned() + "元。"); // 税收前收入
        Z.setmoney(LatestNationalWageTaxStandard(Z.getmoneyEarned())); // 计算个人所得税
        System.out.println("其税收后收入为" + Z.getmoneyEarned() + "元。"); // 税收后收入

        System.out.println("小周:" + Zz.getlaboratory()[0].getLaboratoryName() + "  "
                + Zz.getlaboratory()[1].getLaboratoryName() + "  " + Zz.getlaboratory()[2].getLaboratoryName()
                );

        System.out.println( Zz.getlaboratory()[0].getLaboratoryName() + "  5周成绩如下:");

        for (int t = 0; t < 5; t++) {
            System.out.print(Zz.getlaboratory()[0].getCleanlinessScore()[t] + " ");
        }
        System.out.println();

        System.out.println( Zz.getlaboratory()[1].getLaboratoryName() + "  5周成绩如下:");

        for (int t = 0; t < 5; t++) {
            System.out.print(Zz.getlaboratory()[1].getCleanlinessScore()[t] + " ");
        }
        System.out.println();

        System.out.println( Zz.getlaboratory()[2].getLaboratoryName() + "  5周成绩如下:");

        for (int t = 0; t < 5; t++) {
            System.out.print(Zz.getlaboratory()[2].getCleanlinessScore()[t] + " ");
        }
        System.out.println();

        System.out.println("其纳税前收入为" + Zz.getmoneyEarned() + "元。");

        Zz.setmoney(LatestNationalWageTaxStandard(Zz.getmoneyEarned()));
        System.out.println("其税收后收入为" + Zz.getmoneyEarned() + "元。");

    }

}
